import { imapi } from './instance'
export default {
	//查询会话列表信息
	async queryConversationList() {
		const config = {
			// 会话锚点，传空则代表从最新开始查询
			nextConversation: null,
			// 会话一次分页查询数
			count: 50
		};
		const data = await imapi({ name: 'queryConversationList', attr: 'conversationList' }, config)
		return data
	},
	//清除单个会话消息未读数
	async clearConversationCount({ conversationID, conversationType = 0 }) {
		const data = await imapi({ name: 'clearConversationUnreadMessageCount' }, conversationID, conversationType)
		return data
	},
	//清除全部会话消息未读数
	async clearConversationTotalCount() {
		const data = await imapi({ name: 'clearConversationTotalUnreadMessageCount' })
		return data
	},
	//删除单个会话 conversationType：0=单聊，2=群聊
	async deleteConversation({ conversationID, conversationType = 0 }) {
		const config = { isAlsoDeleteServerConversation: true };
		const data = await imapi({ name: 'deleteConversation' }, conversationID, conversationType, config)
		return data
	},
}